<include file="Public:header" />
<include file="Public:leftside" />
<style>
	.file-item {
		float: left;
		position: relative;
		margin: 0 20px 20px 0;
		padding: 4px;
		background: #000;
	}
	
	.ee_span {
		background: #eee;
		height: 35px;
		display: block;
		line-height: 35px;
		padding-left: 9px;
	}
</style>
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li>
				<a href="/Store/store_list/">店铺管理</a>
			</li>
			<php>if($_GET['id']){</php>
			<li class="active">修改店铺</li>
			<php>}else{</php>
			<li class="active">添加店铺</li>
			<php>}</php>
		</ul>
	</div>
	<div class="page-content" style="padding: 0;border: none;">

		<form action="{:U('Store/store_Save')}" method="post" class="form form-horizontal" role="form">
			<div class="panel-body" style="padding: 0;border: none;">
				<input type="hidden" name="id" value="{$current.id}" />
				<div class="tab-content" style="padding: 16px 12px 55px 12px;">
					<div class="row panel-body">
						<php>if($_GET['id']){</php>
						<a href="{:U('Store/store_list')}" class="btn btn-sm btn-default">店铺管理</a>
						<a href="{:U('Store/storeAdd')}" class="btn btn-sm btn-default">添加店铺</a>
						<a href="javascript:;" class="btn btn-sm btn-primary">编辑店铺</a>
						<php>}else{</php>
						<a href="{:U('Store/store_list')}" class="btn btn-sm btn-default">店铺管理</a>
						<a href="{:U('Store/storeAdd')}" class="btn btn-sm btn-primary">添加店铺</a>
						<php>}</php>

					</div>
					<section class="panel-default m-b-sm" style="margin:5px 0;">
						<div class="alert alert-info">
							<p>
								<i class="fa fa-hand-o-right m-r-xs"></i><strong>操作提示</strong>
							</p>
							<p class="alert-p m-l-xl"><i class="fa fa-caret-right m-r-xs"></i>该页面可对店铺进行添加编辑修改操作。</p>
						</div>
					</section>

					<div class="tab-pane fade active in" id="apply">
						<section class="panel panel-default">
							<header class="panel-heading font-bold"> 基本信息 </header>
							<div class="panel-body">
								<php>if(!$_GET['id']){</php>
								<div class="form-group">
									<label class="col-sm-2 control-label">注册手机号</label>
									<div class="col-md-3">
										<input type="text" class="form-control" id="res_phone" value="">
									</div>
									<input type="button" id="search_res_phone" value="搜索" class="btn btn-sm"/>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">绑定用户ID</label>
									<div class="col-md-3">
										<input type="text" class="form-control" datatype="required" data="绑定用户ID" name="uid" id="b_uid" value="{$current.uid}" readonly="readonly">
									</div>

								</div>
								<php>}else{</php>
									<div class="form-group">
										<label class="col-sm-2 control-label">绑定用户手机</label>
										<div class="col-md-3">
											<input type="text" class="form-control" datatype="required" data="绑定用户手机"  value="{$user.phone}" readonly="readonly">
											<input type="hidden" class="form-control" datatype="required" data="绑定用户ID" name="uid" id="b_uid" value="{$current.uid}" readonly="readonly">
										</div>
	
									</div>
								<php>}</php>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺分类</label>
									<div class="col-md-3">
										<php>$types_array=explode(',',$current['store_classification_type']);</php>
										<select name="store_classification_type[]" class="selectpicker show-tick form-control" multiple data-live-search="false" required>
											<foreach name="store_classifications" item="v" key="k">
												<php>
													if(in_array($v['id'],$types_array)){ $selected='selected'; }else{ $selected=''; }
												</php>

												<option value="{$v.id}" {$selected} <eq name="k" value="0">selected</eq>>{$v.classification}</option>
											</foreach>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺名称</label>
									<div class="col-md-3">
										<input type="text" class="form-control" datatype="required" data="店铺名称" name="title" value="{$current.title}">
									</div>
								</div>

								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺seo关键词</label>
									<div class="col-md-3">
										<input type="text" class="form-control" name="keywords" value="{$current.keywords}"> 多个关键词以英文逗号隔开 如：网上购物,网上商城,手机,笔记本,电脑
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺seo描述</label>
									<div class="col-md-3">
										<textarea name="description" class="form-control">{$current.description}</textarea>
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">公司所在地</label>
									<div class="col-md-2">
										<select class="form-control m-b" name="province" id="seleAreaNext" onchange="getProvince(this,'#seleAreaThird')">
											<option value="">请选择省</option>
										</select>
									</div>
									<div class="col-md-2">
										<select class="form-control m-b" name="city" id="seleAreaThird" onchange="getSelCity(this, '#seleAreaFouth')">
											<option value="">请选择市</option>
										</select>
									</div>
									<div class="col-md-2">
										<select class="form-control m-b" name="district" id="seleAreaFouth">
											<option value="-1">请选择区</option>
										</select>
									</div>

								</div>


								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">公司坐标</label>
									<div class="col-md-3" >

											<div class="row row-fix">
												<div class="col-xs-4 col-sm-4">
													<input type="text" name="lng" value="{$current.lng}" id="lng" placeholder="地理经度" class="form-control">
												</div>
												<div class="col-xs-4 col-sm-4">
													<input type="text" name="lat" value="{$current.lat}"id="lat"  placeholder="地理纬度" class="form-control">
												</div>
												<div class="col-xs-4 col-sm-4">
													<button onclick="show()"  class="btn btn-default" type="button">选择坐标</button>
												</div>
											</div>

									</div>
								</div>

								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">公司详细地址</label>
									<div class="col-md-3">
										<input type="text" class="form-control" datatype="required" data="公司详细地址" id="company_address_detail" name="rel_address" value="{$current.rel_address}">
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">是否全网</label>
									<div class="col-md-3">
										<label class="switch"><input name="quanwang" type="checkbox" <eq name="current.quanwang" value="1">checked</eq>><span></span></label>
									</div>
								</div>

								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">联系人姓名</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" name="rel_name" value="{$current.rel_name}" datatype="required" data="联系人姓名">
									</div>
									<label class="col-sm-2 control-label">客服电话</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" name="rel_phone" value="{$current.rel_phone}">
									</div>
									<label class="col-sm-2 control-label">电子邮箱</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" name="rel_email" value="{$current.rel_email}">
									</div>

								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">

									<label class="col-sm-2 control-label">身份证</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" name="id_card" value="{$current.id_card}" datatype="required" data="身份证">
									</div>

								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">

									<label class="col-sm-2 control-label">QQ</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" id="contacts_email" name="shop_qq" value="{$current.shop_qq}">
									</div>
									<label class="col-sm-2 control-label">阿里旺旺</label>
									<div class="col-md-2" style="padding-top: 2px">
										<input type="text" class="form-control" id="contacts_email" name="shop_ww" value="{$current.shop_ww}">
									</div>
								</div>

								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺公告</label>
									<div class="col-md-3">
										<textarea name="notice" class="form-control">{$current.notice}</textarea>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺介绍</label>
									<div class="col-md-10">
										<textarea name="pt_jieshao" class="form-control editor">{$current.pt_jieshao}</textarea>
									</div>
								</div>

							</div>
						</section>

						<section class="panel panel-default" id="settlement_info" style="">
							<header class="panel-heading font-bold"> 结算账号信息（支付宝） </header>
							<div class="panel-body">

								<div class="form-group">
									<label class="col-sm-2 control-label">支付宝帐号</label>
									<div class="col-md-3">
										<input type="text" class="form-control" name="ali_number" value="{$current.ali_number}" datatype="required" data="支付宝帐号">
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">真实姓名</label>
									<div class="col-md-3">
										<input type="text" class="form-control" name="ali_name" value="{$current.ali_name}" datatype="required" data="真实姓名">
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">验证手机号</label>
									<div class="col-md-3">
										<input type="text" class="form-control" name="ali_phone" value="{$current.ali_phone}" datatype="required" data="验证手机号">
									</div>
								</div>

								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">平台抽取比率</label>
									<div class="col-md-3">
										<input type="text" class="form-control" name="extraction" value="{$current['extraction']*100}" style="width: 50%;float: left;">
										<span style="width: 50%;float: left;height: 35px;line-height: 35px;">%</span>
									</div>
								</div>
								

							</div>
						</section>

						<section class="panel panel-default" id="smallRoutine_info" style="">
							<header class="panel-heading font-bold"> 小程序配置 </header>
							<div class="panel-body">
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">应用ID[AppID]</label>
									<div class="col-md-3">
										<input type="text" class="form-control" id="APP_KEY" name="APP_KEY" required="" value="{$smallRoutineInfo.APP_KEY}" aria-required="true">
									</div>
									<label class="col-md-6  error" for="APP_KEY"></label>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">APP_SECRET</label>
									<div class="col-md-3">
										<input type="text" class="form-control" id="APP_SECRET" name="APP_SECRET" required="" value="{$smallRoutineInfo.APP_SECRET}" aria-required="true">
									</div>
									<label class="col-md-6 error" for="APP_SECRET"></label>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-lg-2 control-label">微信小程序支付商户号[MCHID]</label>
									<div class="col-md-3">
										<input type="text" class="form-control" id="MCHID" name="MCHID" required="" value="{$smallRoutineInfo.MCHID}" aria-required="true">
									</div>
									<label class="col-md-6 error" for="MCHID"></label>
								</div>
                                <div class="line line-dashed line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label">商户支付密钥[MCHID_KEY]</label>
                                    <div class="col-md-3">
                                        <input type="text" class="form-control" id="MCHID_KEY" name="MCHID_KEY" required="" value="{$smallRoutineInfo.MCHID_KEY}" aria-required="true">
                                    </div>
                                    <label class="col-md-6 error" for="MCHID_KEY"></label>
                                </div>

							</div>
						</section>

						<section class="panel panel-default" id="settlement_info" style="">
							<header class="panel-heading font-bold"> 店铺属性 </header>
							<div class="panel-body">
								<div class="form-group">
									<label class="col-sm-2 control-label">所属等级</label>
									<div class="col-md-4">
										<select id="shop_type" name="store_type" class="form-control m-b">
											<option value="1" <eq name="current.store_type" value="1">selected</eq>>直营店铺</option>
											<option value="2" <eq name="current.store_type" value="2">selected</eq>>加盟店铺</option>
										</select>
										
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">描述相符度分数</label>
									<div class="col-md-4">
										<select id="shop_desccredit" name="store_desccredit" class="form-control m-b">
											<option value="1" <eq name="current.store_desccredit" value="1">selected</eq>>1星</option>
											<option value="2" <eq name="current.store_desccredit" value="2">selected</eq>>2星</option>
											<option value="3" <eq name="current.store_desccredit" value="3">selected</eq>>3星</option>
											<option value="4" <eq name="current.store_desccredit" value="4">selected</eq>>4星</option>
											<option value="5" <eq name="current.store_desccredit" value="5">selected</eq>>5星</option>
										</select>
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">服务态度分数</label>
									<div class="col-md-4">
										<select id="shop_servicecredit" name="store_servicecredit" class="form-control m-b">
											<option value="1" <eq name="current.store_servicecredit" value="1">selected</eq>>1星</option>
											<option value="2" <eq name="current.store_servicecredit" value="2">selected</eq>>2星</option>
											<option value="3" <eq name="current.store_servicecredit" value="3">selected</eq>>3星</option>
											<option value="4" <eq name="current.store_servicecredit" value="4">selected</eq>>4星</option>
											<option value="5" <eq name="current.store_servicecredit" value="5">selected</eq>>5星</option>
										</select>
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">发货速度分数</label>
									<div class="col-md-4">
										<select id="shop_deliverycredit" name="store_deliverycredit" class="form-control m-b">
											<option value="1" <eq name="current.store_deliverycredit" value="1">selected</eq>>1星</option>
											<option value="2" <eq name="current.store_deliverycredit" value="2">selected</eq>>2星</option>
											<option value="3" <eq name="current.store_deliverycredit" value="3">selected</eq>>3星</option>
											<option value="4" <eq name="current.store_deliverycredit" value="4">selected</eq>>4星</option>
											<option value="5" <eq name="current.store_deliverycredit" value="5">selected</eq>>5星</option>
										</select>
									</div>
								</div>
								<div class="line line-dashed line-lg pull-in"></div>
							
								<div class="form-group">
									<label class="col-sm-2 control-label">店铺状态</label>
									<div class="col-md-10">
										<div class="col-md-3">
											<p>首页推荐</p>

											<label class="switch"><input name="recommend" type="checkbox" <eq name="current.recommend" value="1">checked</eq>><span></span></label>
										</div>
										<div class="col-md-3">
											<p>推广</p>
											<label class="switch"><input name="spread" type="checkbox" <eq name="current.spread" value="1">checked</eq>><span></span></label>
										</div>
										<div class="col-md-3">
											<p>是否开启</p>
											<label class="switch"><input name="status" type="checkbox" <eq name="current.status" value="1">checked</eq>><span></span></label>
										</div>
										<!--<div class="col-md-3">
												<p>退货承诺</p>
												<label class="switch"><input id="shop_tuihuo" type="checkbox"><span></span></label>
											</div>
											<div class="col-md-3">
												<p>试用中心</p>
												<label class="switch"><input id="shop_shiyong" type="checkbox"><span></span></label>
											</div>
											<div class="col-md-3">
												<p>实体验证</p>
												<label class="switch"><input id="shop_shiti" type="checkbox"><span></span></label>
											</div>
											<div class="col-md-3">
												<p>消协保证</p>
												<label class="switch"><input id="shop_xiaoxie" type="checkbox" checked=""><span></span></label>
											</div>
											<div class="col-md-3">
												<p>货到付款</p>
												<label class="switch"><input id="shop_huodaofk" type="checkbox"><span></span></label>
											</div>-->
									</div>
								</div>
							</div>

						</section>
						<div class="col-sm-4 col-sm-offset-2" style="margin-top: 10px;">
							<button class="formSubmit btn btn-primary btn-sm" id="form" value="保存" ajax="1" type="button">保存</button> &nbsp; &nbsp; &nbsp;
							<button class="btn btn-primary btn-sm btn-danger" value="取消" type="button" onclick="history.back(-1);">取消</button>
						</div>
					</div>
				</div>
			</div>

		</form>
	</div>
	<input type="hidden" id="company_province_id" value="{$current.province}">
	<input type="hidden" id="company_city_id" value="{$current.city}">
	<input type="hidden" id="company_district_id" value="{$current.district}">

	<script>
		//全局变量
		var GV = {
			DIMAUB: "/",
            JS_ROOT: "NewAdmin/js/",
			TOKEN: ""
		};
	</script>
	<script type="text/javascript" src="/NewAdmin/js/webuploader/webuploader.js"></script>
	<script type="text/javascript" src="/NewAdmin/js/webuploader/getting-started.js"></script>
	<link rel="stylesheet" href="/NewAdmin/css/webuploader.css" />
	<script src="/NewAdmin/js/wind.js"></script>
	<link href="/NewAdmin/js/artDialog/skins/default.css" rel="stylesheet" />
	<script src="/NewAdmin/js/zhlmy.js"></script>
	<script src="/NewAdmin/js/init_address.js"></script>
	<script type="text/javascript">
		var BASE_URL = '/NewAdmin/js/webuploader/';
		var UPLOAD_SERVER = '{:U("User/uploadify_wb")}';
		var UpFilePathInfo = '<?=$menuCurrent['UpFilePathInfo']?>';
		$(function() {
			if($("#company_province_id").val() == null) {
				provice_id = 0;
			} else {
				provice_id = $("#company_province_id").val();
			}
			if($("#company_city_id").val() == null) {
				city_id = -1;
			} else {
				city_id = $("#company_city_id").val();
			}
			if($("#company_district_id").val() == null) {
				district_id = -1;
			} else {
				district_id = $("#company_district_id").val();
			}

			if(provice_id == 0) {
				initProvince('#seleAreaNext');
			} else {
				load('province', provice_id, 'city', city_id, 'district', district_id);
			}

			$('#uploader img').attr('src', UpFilePathInfo);
			$(':input[name="UpFilePathInfo"]').val(UpFilePathInfo);
			$("#uploader").setUploader(null, {
				uploadImgType: 'normal',
				thumb: {
					height: 102
				}
			});
			$('#search_res_phone').click(function(){
				var phone=$('#res_phone').val();
				if(phone){
					$.get('/store/search_phone/phone/'+phone, function(data) {
						if(data==0){
							layer.msg('该用户不存在！');
							
						}else if(data==1){
							layer.msg('该用户已经开店！');
						}else{
							$('#b_uid').val(data.id);
						}
				});
				}else{
					layer.msg('请输入绑定手机号');
				}
			})
		});
	</script>


	<div id="drag">
		<div class="title">
			<h2>1.选择位置>2.标注位置>3.保存位置</h2>

		</div>
		<div class="content">
			<div id="f_container">
				<div id="container"></div>
			</div>
			<div id="allmap" style="width:790px;height:500px;"></div>
			<div style="margin: 15px;text-align: right">
				<input type="hidden" id="lat"><input type="hidden" id="lng">
				<input type="button" onclick="showMap();" class="btn" value="保存">
				<input type="button" onclick="dhide()" class="btn" value="取消">
			</div>
		</div>
	</div>


	<include file="Public:footer" />


	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=826e806b86676d155282de3d37188137"></script>
	<script src="http://api.map.baidu.com/library/MarkerTool/1.2/src/MarkerTool_min.js" type="text/javascript"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/library/CityList/1.4/src/CityList_min.js"></script>
	<script type="text/javascript" src="/static/js/tuodong.js"></script>



	<style type="text/css">
		/* drag */
		#drag{position:absolute;top:10%;left:35%;width:800px;height:auto;background:#e9e9e9;border:1px solid #444;border-radius:5px;box-shadow:0 1px 3px 2px #666;display: none;z-index: 9999;}
		#drag .title{position:relative;height:27px;margin:5px;}
		#drag .title h2{font-size:14px;height:27px;line-height:24px;border-bottom:1px solid #A1B4B0;}
		#drag .title div{position:absolute;height:19px;top:2px;right:0;}
		#drag .title a{float:left;width:21px;height:19px;display:block;margin-left:5px;background:url(/static/images/tool.png) no-repeat;}
		#drag .title a.max{background-position:-60px 0;}
		#drag .title a.max:hover{background-position:-60px -29px;}
		#drag .title a.revert{background-position:-149px 0;display:none;}
		#drag .title a.revert:hover{background-position:-149px -29px;}
		#drag .title a.close{background-position:-89px 0;}
		#drag .title a.close:hover{background-position:-89px -29px;}
		#drag .content{overflow:auto;margin:0 5px;}

		#f_container{border: 1px solid #999999;position: absolute;top:50px;left: 10px;z-index: 1000;    }
		#container{width:290px;overflow: hidden;height: 75px;background:#F2F3F5;border: 5px solid #F2F3F5; }
		#container select{border: 1px solid #ccc;}
		.content .btn{width:105px; height: 30px;font-size: 13px; }
	</style>
	<script type="text/javascript">
        var marker, oDrag = document.getElementById("drag");
        // 百度地图API功能
        var map = new BMap.Map("allmap");            // 创建Map实例
        map.enableScrollWheelZoom(true);
        map.addControl(new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT}));    // 右下比例尺
        map.setDefaultCursor("Crosshair");//鼠标样式
        map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT}));  //右上角，仅包含平移和缩放按钮
        var cityList = new BMapLib.CityList({
            container: 'container',
            map: map
        });
        map.addEventListener("click", showInfo);
        function showInfo(e){
            map.clearOverlays();
            marker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat));  // 创建标注
            map.addOverlay(marker);
            //获取经纬度
            document.getElementById("lng").value = e.point.lng;
            document.getElementById("lat").value = e.point.lat;
        }

        function show(){
            map.centerAndZoom('北京',12);                   // 初始化地图,设置城市和地图级别。
            oDrag.style.display = "block";
       
        }
        function dhide(){
            map.clearOverlays();

            oDrag.style.display = "none";
        }

        function showMap(){
            oDrag.style.display = "none";
            var map1 = new BMap.Map("show_map");
            var lng = document.getElementById("lng").value;
            var lat = document.getElementById("lat").value;
            map1.centerAndZoom(new BMap.Point(lng, lat), map.getZoom());
            var marker1 = new BMap.Marker(new BMap.Point(lng, lat));  // 创建标注
            map1.addOverlay(marker1);              // 将标注添加到地图中
        }
	</script>